package git.determinal.template.service.impl;

import git.determinal.template.dao.UserDao;
import git.determinal.template.service.UserService;

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * @Description
 * @Author determinal
 * @Date 2024/6/20 上午11:49
 */
public class UserServiceImpl implements UserService/*, InitializingBean*/ {
    private UserDao userDao;
    // 注入List
    private List<String> stringList;
    // 注入复杂类型List
    private List<UserDao> userDaoList;
    // 注入Set
    private Set<String> stringSet;
    // 注入Map
    private Map<String, UserDao> userDaoMap;
    // Properties
    private Properties properties;

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    public void setUserDaoMap(Map<String, UserDao> userDaoMap) {
        this.userDaoMap = userDaoMap;
    }

    public void setStringSet(Set<String> stringSet) {
        this.stringSet = stringSet;
    }

    public void setUserDaoList(List<UserDao> userDaoList) {
        this.userDaoList = userDaoList;
    }

    public void setStringList(List<String> stringList) {
        this.stringList = stringList;
    }
//    public UserServiceImpl(){
//        System.out.println("UserServiceImpl无参构造方法执行");
//    }

    public void show(){
        System.out.println(stringList);
        System.out.println(userDaoList);
    }

    public UserServiceImpl() {
        System.out.println("UserServiceImpl有参构造方法执行");
    }

//    public void init() {
//        System.out.println("初始化方法……");
//    }
//
//    public void destroy() {
//        System.out.println("销毁方法……");
//    }

    // BeanFactory去调用该方法 从容器中获的userDao设置到此处
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
//        System.out.println("BeanFactory去调用该方法获得userDao设置到此处:"+userDao);
    }

//    @Override
//    public void afterPropertiesSet() throws Exception {
//        System.out.println("afterPropertiesSet执行……");
//    }
}
